{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ba20d3b1-8698-43a6-bd83-495661cdcfc4",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "58997f23-b3da-457d-8d1d-7c6c1022aa56",
   "metadata": {},
   "outputs": [],
   "source": [
    "A = np.random.rand(1000,1000)\n",
    "cond1 = np.linalg.cond(A)\n",
    "cond2 = np.linalg.norm(np.linalg.inv(A),ord=2)*np.linalg.norm(A,ord=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "421b24d9-a0bd-4add-a662-45f892fd599e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "293929.72862146125 293929.7286217758\n"
     ]
    }
   ],
   "source": [
    "print(cond1,cond2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "70d7f2bb-ed1d-41d0-bcb1-f16a2882da2c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.37 s ± 61.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
     ]
    }
   ],
   "source": [
    "%%timeit\n",
    "cond1 = np.linalg.cond(A)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "bd8ea7a5-c72a-44c2-9684-8fa92745aad4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.12 s ± 94.2 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
     ]
    }
   ],
   "source": [
    "%%timeit\n",
    "cond2 = np.linalg.norm(np.linalg.inv(A),ord=2)*np.linalg.norm(A,ord=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c2fc2b06-b6f0-4034-983f-b68836536b01",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "EFEM",
   "language": "python",
   "name": "efem"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
